package com.qianfeng.smartplatform.mapper;/*
 *@Description:
 *@author:赵健
 *@Date:zjzzz 2022/9/7 16:38
 */

import com.qianfeng.smartplatform.pojo.SysCategory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface CategoryMapper {
    @Insert("INSERT INTO sys_category (category_name,tx_command,rx_command,command_name,create_by) VALUES (#{categoryName},#{txCommand},#{rxCommand},#{commandName},#{createBy})")
    void addCategory(SysCategory category);

    @Select("SELECT * FROM sys_category WHERE category_name =#{categoryName}")
    SysCategory findByCategoryName(String categoryName);

    @Update("UPDATE sys_category SET category_name=#{categoryName},tx_command=#{txCommand},rx_command=#{rxCommand},command_name=#{commandName},status=#{status},update_by=#{updateBy} WHERE c_id =#{cId}")
    void updateCategory(SysCategory category);

    @Select("SELECT * from sys_category")
    List<SysCategory> findAllCategories();
}
